
<?php if($MODE == "INDEX"){?>
<div class='span12'>
    <!-- HEADER -->
    <div class='row-fluid'>
        <div class='span12'>
            <div class='page-header'>

                <h1 class="span8">
                    <i class='icon-bullhorn'></i>
                    <span>COMMENTS MANAGEMENT</span>
                </h1>
            </div>
        </div>
    </div>

    <!-- END OF HEADER -->


    <div class='row-fluid'>
        <div class="span12 box bordered-box blue-border" style="margin-bottom:0;">
            <div class="box-header blue-background">
                <div class="title">List of Comments</div>
                <div class="actions">
                    <a href="#" class="btn box-remove btn-mini btn-link"><i class="icon-remove"></i>
                    </a>
                    <a href="#" class="btn box-collapse btn-mini btn-link"><i></i>
                    </a>
                </div>
            </div>
            <div class="box-content box-no-padding">
                        <table class="table table-bordered table-striped" >
                            <?php if($comments){?>
                                <thead>
                                <tr>
                                    <th>
                                        Business Name
                                    </th>
                                    <th>
                                        Comment
                                    </th>
                                    <th>
                                       Status 
                                    </th>
                                   
                                </tr>
                                </thead>
                                <tbody>

                                <?php foreach($comments as $comments):?>
                                
                                    <tr>

                                        <td><strong><span class="text text-error"><?=  Comments::find($comments->id)->post()->first()->title;?></span></strong>
                                       <div>
                                        <small class="text"><b>Posted On :</b> <?= $comments->created_at;?></small>
                                       </div>
                                       <div>
                                        <small class="text">  <b>By :</b> <?= $comments->name;?></small>
                                        </div>
                                        </td>
                                        <td class="span6">
                                         <?= Str::limit($comments->comment,150);?>
                                        </td>
                                        <td>


                                            <?php if($comments->status == 51){?>
                                                <span class="label label-success">Active</span>
                                            <?php }else{ ?>
                                                <span class="label label-important">Inactive</span>
                                            <?php } ?>
                                        </td>
                                        <td>
                                            <div class="text-right">
                                                <?php if($comments->status == "1"){?>
                                                <a class="btn btn-success btn-mini" href="<?= URL::to("comments/admin/comments/update_status/$comments->id/$comments->status");?>" title="Make it Active"  <?php if(Config::get('application.mode')){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" 
                                        <?}else{?>onclick="return confirm('Are you sure ?');"<?php }?>>
                                                    Active
                                                </a>
                                                <?php }?>
                                                <?php if($comments->status == "51"){?>
                                                    <a class="btn btn-danger btn-mini" href="<?= URL::to("comments/admin/comments/update_status/$comments->id/$comments->status");?>" title="Make it Inactive"  <?php if(Config::get('application.mode')){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" 
                                        <?}else{?>onclick="return confirm('Are you sure ?');"<?php }?>>
                                                        Inactive
                                                    </a>
                                                <?php }?>

                                                <a class="btn btn-success btn-mini" href="<?= URL::to("comments/admin/comments/edit/$comments->id");?>" title="Edit"  >
                                                    <i class="icon-edit"></i>
                                                </a>
                                                <a class="btn btn-danger btn-mini" href="<?= URL::to("comments/admin/comments/delete/$comments->id");?>" title="Delete"  <?php if(Config::get('application.mode')){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" 
                                        <?}else{?>onclick="return confirm('Are you sure ?');"<?php }?>>
                                                    <i class="icon-remove"></i>
                                                </a>
                                            </div>
                                        </td>
                                    </tr>

                                <?php endforeach;?>



                                </tbody>
                            <?php }else{?>
                                <div class="alert alert-error">No data found..</div>
                            <?php }?>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    
<?php }?>

<?php if ($MODE == "EDIT"){?>
<div class='span12'>
    <!-- HEADER -->
    <div class='row-fluid'>
        <div class='span12'>
            <div class='page-header'>

                <h1 class="span8">
                    <i class='icon-bullhorn'></i>
                    <span>COMMENTS MANAGEMENT</span>
                </h1>
                
                <div class="span4 text-right">
                    <a href="<?= URL::to('comments/admin/comments');?>" class="btn btn-large btn-inverse">Comments List</a>
                </div>
            </div>
        </div>
    </div>

    <!-- END OF HEADER -->


    <div class='row-fluid'>
        <div class="span12 box bordered-box blue-border" style="margin-bottom:0;">
            <div class="box-header blue-background">
                <div class="title">Edit Comment</div>
                <div class="actions">
                    <a href="#" class="btn box-remove btn-mini btn-link"><i class="icon-remove"></i>
                    </a>
                    <a href="#" class="btn box-collapse btn-mini btn-link"><i></i>
                    </a>
                </div>
            </div>
            <div class="box-content">
                
                <?php if(Session::get('message')) {?>
                <p>
                    <span class="text-danger"> <?php echo Session::get('message');?></span>
                </p>
                <?php }?>
                <form accept-charset="<?= Settings::get('en','charecter_set');?>" action="<?= URL::current();?>" class="form form-horizontal" method="post">
				<h3>Comments Details</h3>
                <hr class="hr-normal">
                    <div class="control-group">
                        <label class="control-label" >Business Title </label>
                        <div class="controls">
                            <input class="input-xlarge" placeholder="Category" type="text"  name="name" value="<?= Comments::find($comments['info']->id)->post()->first()->title;?>" readonly>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" >Comment <span class="text text-error">*</span></label>
                        <div class="controls">
                            <textarea class="input-xxlarge" placeholder="comment"  name="comment" rows="7"><?= $comments['info']->comment;?></textarea>
                        </div>
                    </div>
<h3>Users Details</h3>
                    <hr class="hr-normal">

                    <div class="control-group">
                        <label class="control-label">Posted By</label>
                        <div class="controls">
                            <input class="input-xlarge" placeholder="Posted By" type="text" value="<?= $comments['info']->name;?>" readonly>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Posted Email</label>
                        <div class="controls">
                            <input class="input-xlarge" placeholder="Posted Email" type="text" value="<?= $comments['info']->email;?>" readonly>
                        </div>
                    </div>
                    
                    <div class="control-group">
                        <label class="control-label">Contact No</label>
                        <div class="controls">
                            <input class="input-xlarge" placeholder="Contact No" type="text" value="<?= $comments['info']->contact;?>" readonly>
                        </div>
                    </div>
                    
                    <div class="form-actions">
                        <input type="hidden" name="commentID" id="commentID" value="<?= $comments['info']->id;?>">
                        <button class="btn btn-primary" type="submit"  <?php if(Config::get('application.mode')){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" 
                                        <?}else{?>onclick="return confirm('Are you sure ?');"<?php }?>>
                        
                            <i class="icon-save"></i>
                            Save
                        </button>
                        <button class="btn" type="submit"  <?php if(Config::get('application.mode')){?>onclick="alert ('Sorry! Not allowed in demo mode '); return false;" 
                                        <?}else{?>onclick="return confirm('Are you sure ?');"<?php }?>>Cancel</button>
                    </div>
                </form>
            </div>
        </div>
    </div>


    <!-- END OF CONTENT -->
</div>




<?php }?>


